﻿<UserControl
  x:Class="River.Folderize.UI.FolderPanel"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  xmlns:localUI="clr-namespace:River.Folderize.UI"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
  mc:Ignorable="d" 
  d:DesignHeight="315" d:DesignWidth="450"
  Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}">

  <UserControl.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/Folderize;component/Themes/Generic.xaml" />
      </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
  </UserControl.Resources>

  <Grid>
    <DockPanel Margin="10" >
      <StackPanel Orientation="Vertical" DockPanel.Dock="Top">
        <Label Content="Default Folders" FontFamily="Tahoma" FontSize="14" HorizontalAlignment="Left"
          VerticalAlignment="Top" Foreground="Green"/>
        <Grid Margin="12,0,0,10">
          <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
          </Grid.ColumnDefinitions>
          <Grid.RowDefinitions>
            <RowDefinition Height="38"/>
            <RowDefinition Height="38"/>
          </Grid.RowDefinitions>
          <localUI:FolderSelectorControl
          x:Name="desFolder" Grid.Row="0" Grid.Column="0"
          Checked="IncludeSystemFolder" Unchecked="ExcludeSystemFolder"/>
          <localUI:FolderSelectorControl
          x:Name="dowFolder" Grid.Row="0" Grid.Column="1" 
          Checked="IncludeSystemFolder" Unchecked="ExcludeSystemFolder"/>
          <localUI:FolderSelectorControl
          x:Name="docFolder" Grid.Row="0" Grid.Column="2" 
          Checked="IncludeSystemFolder" Unchecked="ExcludeSystemFolder"/>
          <localUI:FolderSelectorControl
          x:Name="musFolder" Grid.Row="1" Grid.Column="0" 
          Checked="IncludeSystemFolder" Unchecked="ExcludeSystemFolder"/>
          <localUI:FolderSelectorControl
          x:Name="picFolder" Grid.Row="1" Grid.Column="1" 
          Checked="IncludeSystemFolder" Unchecked="ExcludeSystemFolder"/>
          <localUI:FolderSelectorControl
          x:Name="vidFolder" Grid.Row="1" Grid.Column="2" 
          Checked="IncludeSystemFolder" Unchecked="ExcludeSystemFolder"/>
        </Grid>
      </StackPanel>

      <DockPanel DockPanel.Dock="Top">
        <Label
          Content="Custom Folders" DockPanel.Dock="Left"
          FontFamily="Tahoma" FontSize="14" Foreground="Green"
          HorizontalAlignment="Left" VerticalAlignment="Top" />
        <Menu DockPanel.Dock="Right" HorizontalAlignment="Right" Background="White" VerticalAlignment="Bottom">
          <MenuItem>
            <MenuItem.Header>
              <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                <TextBlock Text="Special"/>
                <Path
                  x:Name="BtnArrow" Margin="4,4,0,4" VerticalAlignment="Center" Width="6" 
                  Fill="#FF527DB5" Stretch="Uniform" HorizontalAlignment="Right"
                  Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z "/>
              </StackPanel>
            </MenuItem.Header>
            <MenuItem
              x:Name="topLibrariesMenu"
              IsCheckable="True" IsChecked="{Binding AtTop, Mode=OneWay}"
              Checked="SetFolderSortOrder" Unchecked="SetFolderSortOrder" Tag="UserLibraries">
              <MenuItem.Header>
                <StackPanel Orientation="Horizontal">
                  <Image Source="{Binding Image}" VerticalAlignment="Center" Width="16" Height="16" />
                  <Label Content="Libraries at top" VerticalAlignment="Center" />
                </StackPanel>
              </MenuItem.Header>
            </MenuItem>
            <MenuItem
              x:Name="topOneDriveMenu" 
              IsCheckable="True" IsChecked="{Binding AtTop, Mode=OneWay}"
              Checked="SetFolderSortOrder" Unchecked="SetFolderSortOrder" Tag="OneDrive">
              <MenuItem.Header>
                <StackPanel Orientation="Horizontal">
                  <Image Source="{Binding Image}" VerticalAlignment="Center" Width="16" Height="16" />
                  <Label Content="OneDrive at top" VerticalAlignment="Center" />
                </StackPanel>
              </MenuItem.Header>
            </MenuItem>
          </MenuItem>
        </Menu>
      </DockPanel>

      <DockPanel LastChildFill="True" DockPanel.Dock="Top" Margin="0,5,0,0">
        <StackPanel Orientation="Vertical" Margin="10,5,10,0" DockPanel.Dock="Left">
          <localUI:ImageButton 
            x:Name="addButton"
            Click="AddCustomFolder"
            ToolTip="Add new custom folder"
            NormalImage="{DynamicResource NewFolder}"
            HoverImage="{DynamicResource NewFolderHover}"
            PressedImage="{DynamicResource NewFolder}"
            DisabledImage="{DynamicResource NewFolderDisabled}"
            Padding="0" HorizontalAlignment="Center" Margin="0,0,0,4" />
          <localUI:ImageButton 
            x:Name="removeButton"
            Click="RemoveCustomFolder"
            ToolTip="Remove custom folder" IsEnabled="False"
            NormalImage="{DynamicResource RemoveFolder}"
            HoverImage="{DynamicResource RemoveFolderHover}"
            PressedImage="{DynamicResource RemoveFolder}"
            DisabledImage="{DynamicResource RemoveFolderDisabled}"
            Padding="0" HorizontalAlignment="Center" Margin="0,0,0,4" />
          <localUI:ImageButton 
            x:Name="iconButton"
            Click="EditProperties"
            ToolTip="Change folder properties" IsEnabled="False"
            NormalImage="{DynamicResource ChangeIcon}"
            HoverImage="{DynamicResource ChangeIconHover}"
            PressedImage="{DynamicResource ChangeIcon}"
            DisabledImage="{DynamicResource ChangeIconDisabled}"
            Padding="0" HorizontalAlignment="Center" Margin="0,0,0,4" />
          <localUI:ImageButton 
            x:Name="libraryButton"
            Click="AddLibraryFolder"
            ToolTip="Add Libraries folder"
            NormalImage="{DynamicResource Library}"
            HoverImage="{DynamicResource LibraryHover}"
            PressedImage="{DynamicResource Library}"
            DisabledImage="{DynamicResource LibraryDisabled}"
            Padding="0" HorizontalAlignment="Center" Margin="0,0,0,4" />
          <localUI:ImageToggle
            x:Name="pinButton"
            Click="TogglePinned"
            IsChecked="False" IsEnabled="False"
            ToolTip="Pin to Explorer navigation panel"
            CheckedImage="{DynamicResource Pin}"
            CheckedDisabledImage="{DynamicResource PinDisabled}"
            CheckedHoverImage="{DynamicResource PinHover}"
            UncheckedImage="{DynamicResource Unpin}"
            UncheckedDisabledImage="{DynamicResource UnpinDisabled}"
            UncheckedHoverImage="{DynamicResource UnpinHover}"
            Margin="4,5,3,5" Width="Auto" />
        </StackPanel>
        <Label
      	  x:Name="pathLabel" Content="" Foreground="DarkGray" FontSize="11" Padding="0"
      	  Margin="7,0,0,5" DockPanel.Dock="Bottom"/>
        <ListBox
          Grid.IsSharedSizeScope="True"
          SelectionChanged="SelectionChanged" x:Name="customFoldersList" 
          DockPanel.Dock="Left" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
          <ListBox.ItemsPanel>
            <ItemsPanelTemplate>
              <WrapPanel Orientation="Horizontal"/>
            </ItemsPanelTemplate>
          </ListBox.ItemsPanel>
          <ListBox.ItemTemplate>
            <DataTemplate>
              <StackPanel Orientation="Horizontal" MouseDown="EditItem">
                <Grid>
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition SharedSizeGroup="any" />
                  </Grid.ColumnDefinitions>
                  <Image
                    Grid.Column="0" Margin="2" Width="32" Height="32" Source="{Binding Image}"/>
                  <TextBlock
                    VerticalAlignment="Center" Margin="0,2" Grid.Column="1"
                    TextWrapping="Wrap" TextTrimming="CharacterEllipsis"
                    Text="{Binding Name}"/>
                </Grid>
              </StackPanel>
            </DataTemplate>
          </ListBox.ItemTemplate>
        </ListBox>
      </DockPanel>
    </DockPanel>

    <localUI:PropertiesPanel
      x:Name="editor" Visibility="Hidden" Completed="PropertiesCompleted"/>

  </Grid>
</UserControl>
